import request from '@/utils/request';

/**
 * 分销管理佣金记录
 * @param params 查询条件
 */

export async function getDistributionCommission(params) {
  const res = await request.get(
    '/massage/commissionRecords/getDistributionCommission',
    { params }
  );

  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 *  佣金删除
 * @param params 查询条件
 */

export async function commissionDelete(id) {
  const res = await request.delete('/massage/commissionRecords/' + id);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 *  批量删除
 * @param params 查询条件
 */
export async function commissionDeleteBatch(data) {
  const res = await request.delete('/massage/commissionRecords/batch', {
    data
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
